
const {goods} = require('./goods.json');

let arr = goods.map((item, index) => {
    item.id= index+1;
    return item;
});

require('fs').writeFileSync('./goods.json', JSON.stringify({goods: arr}))